/*
 * @lc app=leetcode.cn id=75 lang=cpp
 *
 * [75] 颜色分类
 */

// @lc code=start
class Solution
{
public:
  void sortColors(vector<int>& nums)
  {
    int n = nums.size();
    int cnt_zero = count(nums.begin(), nums.end(), 0);
    int cnt_one = count(nums.begin(), nums.end(), 1);
    fill(nums.begin(), nums.begin() + cnt_zero, 0);
    fill(nums.begin() + cnt_zero, nums.begin() + cnt_zero + cnt_one, 1);
    fill(nums.begin() + cnt_zero + cnt_one, nums.end(), 2);
  }
};
// @lc code=end
